﻿using Common.Communal;
using MediatR;
using Scheduling.Api.Write.Application.Command.TeamCommand;
using Scheduling.Services.Teams;

namespace Scheduling.Api.Write.Application.CommandHandlers.TeamHandler
{
    public class TeamDelCommandHandler : IRequestHandler<TeamDelCommand, ApiResult<int>>
    {
        public TeamDelCommandHandler(ITeamServices teams)
        {
            Teams = teams;
        }

        public ITeamServices Teams { get; }

        public async Task<ApiResult<int>> Handle(TeamDelCommand request, CancellationToken cancellationToken)
        {
            return await Teams.DeleteTeam(request.TeamId);
        }
    }
}
